/******************************************************************************
 * * inter_contacts_interface.h - internal interface between contacts and others
 *
 * *(C) Copyright 2019 ASR International Ltd.
 * * All Rights Reserved
 * ******************************************************************************/
#ifndef INTER_CONTACTS_INTERFACE_H
#define INTER_CONTACTS_INTERFACE_H

#ifdef __cplusplus
extern "C" {
#endif

#include "modem/mmi_modemadp_interface.h"

/**
 * Reboot contacts module
 * param (in) VOID
 * return  VOID
 */
extern VOID Contacts_Reboot_Req(VOID);

/**
 * Initiate contacts module
 * param (in) VOID
 * return  VOID
 */
extern VOID Contacts_Init_Req(VOID);

typedef struct {
#define IF_CONTACTS_NO_TONE 0xFE
#define IF_CONTACTS_DEFAULT_TONE 0xFF
    UINT8 ToneIndex;
    BOOL  NumScrnFlg;
#define IF_CONTACTS_MAX_NAME_LENGTH    NV_CONTACTS_MAX_NAME_LEN
    INT8  Name[IF_CONTACTS_MAX_NAME_LENGTH];
} If_Contacts_Contact_Para_t;

/**
 * Get parameters associated with the phone number
 * param (in) Number: INT8*
 * param (out) ContactPara: If_Contacts_Contact_Para_t*
 * return  VOID
 */
extern VOID Contacts_Get_Contact_Para_Req(INT8 *Number, If_Contacts_Contact_Para_t *ContactPara);

/**
 * Get contact number
 * param (in) Name: INT8*
 * return  INT8*: contact number
 */
extern INT8 *Contacts_Get_Contact_Number_Req(INT8 *Name);

typedef struct If_Contacts_Contact_Info_Node_t {
    UINT8  ToneIndex;
    BOOL   MarkFlg;
    UINT16 MemoryAndIndex;
    INT8   Name[IF_CONTACTS_MAX_NAME_LENGTH];
#define IF_CONTACTS_MAX_NUMBER_LENGTH    NV_CONTACTS_MAX_NUMBER_LEN
    INT8   Number[IF_CONTACTS_MAX_NUMBER_LENGTH];
} If_Contacts_Info_t;

typedef struct {
    If_Contacts_Info_t *ContactInfo;
} If_Contacts_List_t;

/**
 * Get contact list from contacts APP
 * param (in) VOID
 * return  If_Contacts_List_t*: header address of contacts list, not free
 */
extern If_Contacts_List_t *Contacts_Get_Contact_List_Req(VOID);

/**
 * Save the contact
 * param (in) SrcActId: UINT16, refers to ACTIVITY_ID in nav.h
 * param (in) Number: INT8*
 * return  VOID
 */
extern VOID Contacts_Save_Contact_Req(UINT16 SrcActId, INT8 *Number);

/**
 * Add number to number screening list from framework or SMS module
 * param (in) SrcActId: UINT16, refers to ACTIVITY_ID in nav.h
 * param (in) Number: INT8*, not free
 * return  VOID
 */
extern VOID Contacts_Add_Num_To_Scrn_List_Req(UINT16 SrcActId, INT8 *Number);

/**
 * Delete number from number screening list
 * param (in) SrcActId: UINT16, refers to ACTIVITY_ID in nav.h
 * param (in) Number: INT8*, not free
 * return  VOID
 */
extern VOID Contacts_Del_Num_From_Scrn_List_Req(UINT16 SrcActId, INT8 *Number);

/**
 * Get number screening list from contacts APP
 * param (in) VOID
 * return  INT8*: dyadic array, NV_CONTACTS_MAX_NUMBER_IN_SCRN_LIST_NUM * NV_CONTACTS_MAX_NUMBER_LEN
 */
extern INT8 *Contacts_Get_Num_Scrn_List_Req(VOID);

/**
 * Enter number screening list
 * param (in) VOID
 * return  VOID
 */
extern VOID Contacts_Enter_Num_Scrn_List_Req(VOID);

typedef enum {
    IF_CONTACTS_CALL_SEL_ONE_CONTACT = 0,
    IF_CONTACTS_SETTING_SEL_ONE_CONTACT,
    IF_CONTACTS_SMS_SEL_ONE_CONTACT,
    IF_CONTACTS_SMS_SEL_MULTI_CONTACTS
} IF_CONTACTS_SEL_CONTACT_TYPE;

/**
 * Select contact in contacts APP, don`t display option button
 * If contact is empty, display warning and return to source APP
 * param (in) Type: IF_CONTACTS_SEL_CONTACT_TYPE
 * return  VOID
 */
extern VOID Contacts_Select_Contact_Req(IF_CONTACTS_SEL_CONTACT_TYPE Type);

/**
 * Inform Call APP of the contact selected in contacts APP
 * param (in) Name: INT8*
 * param (in) Number: INT8*
 * return  VOID
 */
extern VOID Contacts_Call_Select_Contact_Cnf(INT8 *Name, INT8 *Number);

/**
 * Inform Setting APP of the contact selected in contacts APP
 * param (in) Number: INT8*
 * return  VOID
 */
extern VOID Contacts_Setting_Select_Contact_Cnf(INT8 *Number);

typedef struct {
    INT8 Name[IF_CONTACTS_MAX_NAME_LENGTH];
    INT8 Number[IF_CONTACTS_MAX_NUMBER_LENGTH];
} If_Contacts_Select_t;

/**
 * Inform SMS APP of the contacts selected in contacts APP
 * param (in) Contact: If_Contacts_Select_Contact_t*
 * return  VOID
 */
extern VOID Contacts_SMS_Select_Contact_Cnf(If_Contacts_Select_t *Contact, UINT16 Count);

/**
 * Call request from contacts APP
 * param (in) Name: INT8*
 * param (in) Number: INT8*
 * return  VOID
 */
extern VOID Contacts_Call_Req(INT8 *Name, INT8 *Number);

/**
 * SMS request from contacts APP
 * param (in) Name: INT8*
 * param (in) Number: INT8*
 * return  VOID
 */
extern VOID Contacts_SMS_Req(INT8 *Name, INT8 *Number);

/**
 * Send phone number by SMS request from contacts APP
 * param (in) Name: INT8*
 * param (in) Number: INT8*
 * return  VOID
 */
extern VOID Contacts_Share_Via_SMS_Req(INT8 *Name, INT8 *Number);

/**
 * Contacts receives SIM status from framework,
 * and then waits for phonebook init ind for the present SIM
 * param (in) SimId: MMI_MODEM_SIM_ID
 * param (in) SimPresent: BOOL
 * return  VOID
 */
extern VOID Contacts_Sim_Status_Ind(MMI_MODEM_SIM_ID SimId, BOOL SimPresent);

/**
 * Get speed dial number from contacts APP
 * param (in) Key: UINT8, digit 2 - 9
 * return  INT8*
 */
extern INT8 *Contacts_Get_Speed_Dial_Number_Req(UINT8 Key);

/**
 * Judge whether the number is in number screening list
 * param (in) Number: INT8 *, not free
 * return  BOOL
 */
extern BOOL Contacts_Is_In_Num_Scrn_List(INT8 *Number);

#ifdef __cplusplus
}
#endif

#endif /*INTER_CONTACTS_INTERFACE_H*/
